// @Author EthanScriptOn
// @Desc
package custom_exp

import (
	"fmt"
	"time"
)

// InterruptError Custom Exception - Process Error - Break Exception
type InterruptError struct {
	msg  string
	time time.Time
}

func (i InterruptError) Error() string {
	return fmt.Sprintf("Error: %s (occurred at %s)", i.msg, i.time.Format(time.RFC3339))
}

func GenerateInterruptError(msg string) *InterruptError {
	return &InterruptError{
		msg:  msg,
		time: time.Now(),
	}
}

// FailError Custom Exception - Process Error - Failure Exception
type FailError struct {
	msg  string
	time time.Time
}

func (f FailError) Error() string {
	return fmt.Sprintf("Error: %s (occurred at %s)", f.msg, f.time.Format(time.RFC3339))
}

func GenerateFailError(msg string) *FailError {
	return &FailError{
		msg:  msg,
		time: time.Now(),
	}
}

// TimeOutError Custom Exception - Process Error - Timeout Exception
type TimeOutError struct {
	msg  string
	time time.Time
}

func (t TimeOutError) Error() string {
	return fmt.Sprintf("Error: %s (occurred at %s)", t.msg, t.time.Format(time.RFC3339))
}

func GenerateTimeOutError(msg string) *TimeOutError {
	return &TimeOutError{
		msg:  msg,
		time: time.Now(),
	}
}
